<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 上传图片处理
 *
 * @author
 **/
class Myupload_model extends CI_Model
{
	public function __construct(){
		parent::__construct();
	}
	
	//上传
	public function upload($file){
		$dir = './data/';
		$date = date("Yd");
		if(!file_exists($dir.$date)){
			mkdir($dir.$date);
		}
		
		$config['upload_path'] = $dir.$date.'/';
		$config['allowed_types'] = 'gif|jpg|png';
		$config['max_size'] = '100';
		$config['max_width']  = '1024';
		$config['max_height']  = '768';
		$this->load->library('upload', $config);
		
		if($this->upload->do_upload()){
			$data = array('upload_data' =>$this->upload->data());
			print_r($data['full_path']);
		}
	}
}